import { getTeacherDetail } from "@/api/teacher_detail"
export default {
  namespaced: true,
  state: () => ({
    // 老师信息
    teacherDetailMsg: {},
    coursePager: {
      page: 1,
      limit: 8,
      total: 0
    }
  }),
  mutations: {
    setTeacherDetail(state, data) {
      state.teacherDetailMsg = data
      state.coursePager.total = data.product_list && data.product_list.length
    }
  },
  actions: {
    // 获取老师信息
    async getTeacherDetail({ commit }, params) {
      let res = await getTeacherDetail(params).catch(err => {
        return { data: {} }
      })
      res && res.data && commit('setTeacherDetail', res.data)
      return true

    }
  },
  getters: {

  }
}